package mvn12.model;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

//Spring切面类                             环绕通知
public class MyUserAspect implements MethodInterceptor {
	
	public void checkPermission() {
		System.out.println("模拟权限验证...");
	}
	
	public void log() {
		System.out.println("模拟写入日志...");
}
	@Override
	public Object invoke(MethodInvocation invocation) 
			throws Throwable {
        checkPermission();
        //调用目标对象的方法
        Object obj = invocation.proceed();
        log();
		return obj;
	}
	
}
